package com.sec.android.app.myfiles.facade.cmd;

import com.sec.android.app.myfiles.dialog.DetailsDialogFragment;
import com.sec.android.app.myfiles.fragment.AbsMyFilesFragment;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;

import org.puremvc.java.multicore.interfaces.INotification;
import org.puremvc.java.multicore.patterns.command.SimpleCommand;

import java.util.ArrayList;

public class ShowDetailCmd extends SimpleCommand {
    public void execute(INotification notification) {
        Object[] params = (Object[]) notification.getBody();
        AbsMyFilesFragment fragment = (AbsMyFilesFragment) params[1];
        @SuppressWarnings("unchecked")
        ArrayList<FileRecord> recordList = (ArrayList<FileRecord>) params[2];
        boolean fromSearch = (boolean) params[3];

        FileRecord curRecord = fragment.getNavigationInfo().getCurRecord();
        DetailsDialogFragment dialog = DetailsDialogFragment.getInstance(recordList, fromSearch);
        dialog.showAllowingStateLoss(fragment.getFragmentManager(), "datails_dialog");
    }
}
